var expect = chai.expect;

describe('BaccaratModel', function() {
    var baccaratData = {
        topic:"/baccarat/B1",
        snapshot:{
            "timestamp": 1,
            "version": 1,
            "room_name": "百家乐壹号房",
            "video": "/video/game1",
            "video_for_dealer": "video used by dealer server",
            "round_id": "round no.",
            "dealer_name": "robot",
            "dealer_offline": false,
            "stage": "bet",
            "countdown_ts": 30,
            "stop_bet_ts": 123456789,
            "cards": {"player_1": 1, "banker_1": 1, "player_2": 1, "banker_2": 1},
            "cards_order": ["player_1", "banker_1", "player_2", "banker_2"],
            "seat_number":1,
            "desk": {
                "1": {"user_id":11, "nick": "机智的小白", "balance": 1000, "type":"player"},
                "2": {"user_id":12, "nick": "Guest", "balance": 1000, "type":"guest"},
                "3": {"user_id":13, "nick": "Guest", "balance": 1000, "type":"guest"},
                "5": {"user_id":14, "nick": "Guest", "balance": 1000, "type":"guest"},
                "6": {"user_id":15, "nick": "Guest", "balance": 1000, "type":"guest"},
                "7": {"user_id":16, "nick": "Guest", "balance": 1000, "type":"guest"},
                "8": {"user_id":17, "nick": "Guest", "balance": 1000, "type":"guest"}
            },
            "bet": {
                "1":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "2":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "3":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "5":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "6":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "7":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "8":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000}
            },
            "payout": {
                "1":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "2":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "3":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "5":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "6":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "7":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "8":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000}
            },
            "natural_winner": true,
            "score": {"banker": 2, "player": 5, "tie": false, "banker_pair": true, "player_pair": false},
            "bet_statistics": {
                "banker": {"users": 5, "amount": 7000},
                "player": {"users": 10, "amount": 8000},
                "tie": {"users": 2, "amount": 1000},
                "banker_pair": {"users": 0, "amount": 0},
                "player_pair": {"users": 1, "amount": 300}
            },
            "round_statistics": {"rounds": 50, "banker": 21, "player": 19, "tie": 10},
            "miCrad_support": true,
            "noCommission_support": true,
            "chips": [10, 100, 1000, 10000],
            "limit": {
                "max": {
                    "banker": 1000,
                    "player": 2000,
                    "tie": 3000,
                    "banker_pair": 4000,
                    "player_pair": 5000
                },
                "min": {"banker": 10, "player": 20, "tie": 30, "banker_pair": 40, "player_pair": 50}
            },
            "status_time": {
                "bet_time": 10,
                "payout_time": 10,
                "open_round_time": 10,
                "mi_time": 10,
                "mi_time_next": 10
            },
            "chat_room_topic": "/chat_room/B1",
            "roadmap_topic": "/roadmap/B1",
            "front_img_url": "dealer front img",
            "flank_img_url": "dealer flank img",
            "player_count": 10,
            "max_payout": 5000
        }
    }
    var baccaratMiData = {
        topic:"/baccarat_micard/B2",
        snapshot:{
            "timestamp": 2,
            "version": 2,
            "room_name": "百家乐咪牌房",
            "video": "/video/game1",
            "video_for_dealer": "video used by dealer server",
            "round_id": "round no.",
            "dealer_name": "robot",
            "dealer_offline": false,
            "stage": "bet",
            "countdown_ts": 30,
            "mi_countdown_ts": 30,
            "mi_extend_countdown_ts": 10,
            "stop_bet_ts": 123456789,
            "cards": {"player_1": 1, "banker_1": 1, "player_2": 1, "banker_2": 1},
            "cards_order": ["player_1", "banker_1", "player_2", "banker_2"],
            "seat_number":1,
            "desk": {
                "1": {"user_id":11, "nick": "机智的小白", "balance": 1000, "type":"player"},
                "2": {"user_id":12, "nick": "Guest", "balance": 1000, "type":"guest"},
                "3": {"user_id":13, "nick": "Guest", "balance": 1000, "type":"guest"},
                "5": {"user_id":14, "nick": "Guest", "balance": 1000, "type":"guest"},
                "6": {"user_id":15, "nick": "Guest", "balance": 1000, "type":"guest"},
                "7": {"user_id":16, "nick": "Guest", "balance": 1000, "type":"guest"},
                "8": {"user_id":17, "nick": "Guest", "balance": 1000, "type":"guest"}
            },
            "bet": {
                "1":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "2":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "3":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "5":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "6":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "7":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "8":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000}
            },
            "payout": {
                "1":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "2":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "3":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "5":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "6":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "7":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000},
                "8":{"banker": 1000, "player": 2000, "tie": 3000, "banker_pair": 4000, "player_pair": 5000}
            },
            "natural_winner": true,
            "score": {"banker": 2, "player": 5, "tie": false, "banker_pair": true, "player_pair": false},
            "bet_statistics": {
                "banker": {"users": 5, "amount": 7000},
                "player": {"users": 10, "amount": 8000},
                "tie": {"users": 2, "amount": 1000},
                "banker_pair": {"users": 0, "amount": 0},
                "player_pair": {"users": 1, "amount": 300}
            },
            "round_statistics": {"rounds": 50, "banker": 21, "player": 19, "tie": 10},
            "miCrad_support": true,
            "noCommission_support": true,
            "chips": [10, 100, 1000, 10000],
            "limit": {
                "max": {
                    "banker": 1000,
                    "player": 2000,
                    "tie": 3000,
                    "banker_pair": 4000,
                    "player_pair": 5000
                },
                "min": {"banker": 10, "player": 20, "tie": 30, "banker_pair": 40, "player_pair": 50}
            },
            "chat_room_topic": "/chat_room/B1",
            "roadmap_topic": "/roadmap/B1",
            "banker_owner": {"name": "user1", "status": "online", "bet": 1000, "userId": 1},
            "player_owner": {"name": "user2", "status": "online", "bet": 500, "userId": 2},
            "table_limit": 1000,
            "banker_left": 500,
            "player_left": 1500,
            "stop_mi_ts": 123456789,
            "add_time": {
                "player_id": 100, //if has add,will exists
                "player_name": "Player Name", //if has add,will exists
                "time_length": 10 //always exists
            },
            "filpCard_status": {
                "player_1": {"status": "flip", "x1": 0, "y1": 0, "x2": 100, "y2": 100},
                "player_2": {"status": "close"},
                "player_3": {"status": "close"},
                "banker_1": {"status": "open"},
                "banker_2": {"status": "flip", "x1": 0, "y1": 0, "x2": 100, "y2": 100},
                "banker_3": {"status": "close"}
            },
            "flip_card_visible": {
                "player": true,
                "banker": true
            },
            "status_time": {
                "bet_time": 10,
                "payout_time": 10,
                "open_round_time": 10,
                "mi_time": 10,
                "mi_time_next": 10
            },
            "front_img_url": "dealer front img",
            "flank_img_url": "dealer flank img",
            "player_count": 10,
            "max_payout": 5000
        }
    }
    game.BaccaratModel.getInstance().baccaratRoomInfo = baccaratData;
    game.BaccaratModel.getInstance().baccaratMiRoomInfo = baccaratMiData;

    it('isMi', function() {
        expect(game.BaccaratModel.getInstance().isMi("/baccarat/B1")).to.be.false;
        expect(game.BaccaratModel.getInstance().isMi("/baccarat_micard/B2")).to.be.true;
        expect(game.BaccaratModel.getInstance().isMi("micardabc")).to.be.false;
    });
    it('isLadder', function() {
        expect(game.BaccaratModel.getInstance().isLadder("/baccarat/B1")).to.be.false;
        expect(game.BaccaratModel.getInstance().isLadder("/baccarat_micard/B2")).to.be.false;
    });
    it('getAllNormalRoom', function() {
        expect(game.BaccaratModel.getInstance().getAllNormalRoom()).to.include.members(["/baccarat/B1"]);
        expect(game.BaccaratModel.getInstance().getAllNormalRoom()).to.have.lengthOf(1);
    });
    it('isHire', function() {
        expect(game.BaccaratModel.getInstance().isHire("/baccarat/B1")).to.be.true;
        expect(game.BaccaratModel.getInstance().isHire("/baccarat_micard/B2")).to.be.true;
        expect(game.BaccaratModel.getInstance().isHire("abc")).to.be.false;
    });
    it('getTableLimit', function() {
        expect(game.BaccaratModel.getInstance().getTableLimit("/baccarat/B1")).to.equal(0);
        expect(game.BaccaratModel.getInstance().getTableLimit("/baccarat_micard/B2")).to.equal(10);
        expect(game.BaccaratModel.getInstance().getTableLimit("abc")).to.equal(0);
    });
    it('getTableMinMaxLimit', function() {
        expect(game.BaccaratModel.getInstance().getTableMinMaxLimit("/baccarat/B1")).to.equal("0.1-50");
        expect(game.BaccaratModel.getInstance().getTableMinMaxLimit("/baccarat_micard/B2")).to.equal("0.1-50");
        expect(game.BaccaratModel.getInstance().getTableMinMaxLimit("abc")).to.equal("");
    });
    it('getRounds', function() {
        expect(game.BaccaratModel.getInstance().getRounds("/baccarat/B1").rounds).to.equal(50);
        expect(game.BaccaratModel.getInstance().getRounds("/baccarat/B1").banker).to.equal(21);
        expect(game.BaccaratModel.getInstance().getRounds("/baccarat/B1").player).to.equal(19);
        expect(game.BaccaratModel.getInstance().getRounds("/baccarat/B1").tie).to.equal(10);
        expect(game.BaccaratModel.getInstance().getRounds("/baccarat_micard/B2").rounds).to.equal(50);
        expect(game.BaccaratModel.getInstance().getRounds("/baccarat_micard/B2").banker).to.equal(21);
        expect(game.BaccaratModel.getInstance().getRounds("/baccarat_micard/B2").player).to.equal(19);
        expect(game.BaccaratModel.getInstance().getRounds("/baccarat_micard/B2").tie).to.equal(10);
        expect(game.BaccaratModel.getInstance().getRounds("abc")).to.be.null;
    });
    it('getDealerName', function() {
        expect(game.BaccaratModel.getInstance().getDealerName("/baccarat/B1")).to.equal("robot");
        expect(game.BaccaratModel.getInstance().getDealerName("/baccarat_micard/B2")).to.equal("robot");
        expect(game.BaccaratModel.getInstance().getDealerName(null)).to.equal("");
    });
    it('getDealerUrl', function() {
        expect(game.BaccaratModel.getInstance().getDealerUrl("/baccarat/B1")).to.equal("dealer front img");
        expect(game.BaccaratModel.getInstance().getDealerUrl("/baccarat_micard/B2")).to.equal("dealer front img");
        expect(game.BaccaratModel.getInstance().getDealerUrl(null)).to.equal("");
    });
    it('getStage', function() {
        expect(game.BaccaratModel.getInstance().getStage("/baccarat/B1")).to.equal("bet");
        expect(game.BaccaratModel.getInstance().getStage("/baccarat_micard/B2")).to.equal("bet");
        expect(game.BaccaratModel.getInstance().getStage(null)).to.equal("");
    });
    it('getBetStatistics', function() {
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat/B1").tie.users).to.equal(2);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat/B1").banker.users).to.equal(5);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat/B1").player.users).to.equal(10);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat/B1").banker_pair.users).to.equal(0);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat/B1").player_pair.users).to.equal(1);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat/B1").tie.amount).to.equal(10);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat/B1").banker.amount).to.equal(70);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat/B1").player.amount).to.equal(80);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat/B1").banker_pair.amount).to.equal(0);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat/B1").player_pair.amount).to.equal(3);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat_micard/B2").tie.users).to.equal(2);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat_micard/B2").banker.users).to.equal(5);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat_micard/B2").player.users).to.equal(10);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat_micard/B2").banker_pair.users).to.equal(0);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat_micard/B2").player_pair.users).to.equal(1);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat_micard/B2").tie.amount).to.equal(10);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat_micard/B2").banker.amount).to.equal(70);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat_micard/B2").player.amount).to.equal(80);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat_micard/B2").banker_pair.amount).to.equal(0);
        expect(game.BaccaratModel.getInstance().getBetStatistics("/baccarat_micard/B2").player_pair.amount).to.equal(3);
        expect(game.BaccaratModel.getInstance().getBetStatistics("")).to.be.null;
    });
    it('getPayout', function() {
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('player_pair', 50);

        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[1].banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[1].player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[1].tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[1].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[1].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[2].banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[2].player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[2].tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[2].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[2].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[3].banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[3].player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[3].tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[3].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[3].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[5].banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[5].player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[5].tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[5].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[5].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[6].banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[6].player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[6].tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[6].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[6].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[7].banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[7].player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[7].tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[7].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[7].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[8].banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[8].player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[8].tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[8].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat/B1", 1)).to.have.deep.property('[8].player_pair', 50);

        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('player_pair', 50);

        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[1].banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[1].player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[1].tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[1].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[1].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[2].banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[2].player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[2].tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[2].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[2].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[3].banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[3].player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[3].tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[3].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[3].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[5].banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[5].player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[5].tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[5].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[5].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[6].banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[6].player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[6].tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[6].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[6].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[7].banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[7].player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[7].tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[7].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[7].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[8].banker', 10);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[8].player', 20);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[8].tie', 30);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[8].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getPayout("/baccarat_micard/B2", 1)).to.have.deep.property('[8].player_pair', 50);

        expect(game.BaccaratModel.getInstance().getPayout("")).to.be.null;
    });

    it('getBet', function() {
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('player_pair', 50);

        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[1].banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[1].player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[1].tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[1].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[1].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[2].banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[2].player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[2].tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[2].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[2].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[3].banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[3].player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[3].tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[3].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[3].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[5].banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[5].player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[5].tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[5].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[5].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[6].banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[6].player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[6].tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[6].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[6].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[7].banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[7].player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[7].tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[7].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[7].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[8].banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[8].player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[8].tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[8].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat/B1", 1)).to.have.deep.property('[8].player_pair', 50);

        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('player_pair', 50);

        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[1].banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[1].player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[1].tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[1].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[1].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[2].banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[2].player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[2].tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[2].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[2].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[3].banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[3].player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[3].tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[3].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[3].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[5].banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[5].player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[5].tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[5].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[5].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[6].banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[6].player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[6].tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[6].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[6].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[7].banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[7].player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[7].tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[7].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[7].player_pair', 50);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[8].banker', 10);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[8].player', 20);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[8].tie', 30);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[8].banker_pair', 40);
        expect(game.BaccaratModel.getInstance().getBet("/baccarat_micard/B2", 1)).to.have.deep.property('[8].player_pair', 50);

        expect(game.BaccaratModel.getInstance().getBet("")).to.be.null;
    });

    it('getTotalBet', function() {
        expect(game.BaccaratModel.getInstance().getTotalBet("/baccarat/B1",1),"B1房间总下注应该是150").to.equal(150);
        expect(game.BaccaratModel.getInstance().getTotalBet("/baccarat_micard/B2",1),"B2房间总下注应该是150").to.equal(150);
        expect(game.BaccaratModel.getInstance().getTotalBet(null),"null房间总下注应该是0").to.equal(0);
    });
    it('getCardsOrder', function() {
        expect(game.BaccaratModel.getInstance().getCardsOrder("/baccarat/B1")).to.have.deep.property('[0]', "player_1");
        expect(game.BaccaratModel.getInstance().getCardsOrder("/baccarat/B1")).to.have.deep.property('[1]', "banker_1");
        expect(game.BaccaratModel.getInstance().getCardsOrder("/baccarat/B1")).to.have.deep.property('[2]', "player_2");
        expect(game.BaccaratModel.getInstance().getCardsOrder("/baccarat/B1")).to.have.deep.property('[3]', "banker_2");
        expect(game.BaccaratModel.getInstance().getCardsOrder("/baccarat_micard/B2")).to.have.deep.property('[0]', "player_1");
        expect(game.BaccaratModel.getInstance().getCardsOrder("/baccarat_micard/B2")).to.have.deep.property('[1]', "banker_1");
        expect(game.BaccaratModel.getInstance().getCardsOrder("/baccarat_micard/B2")).to.have.deep.property('[2]', "player_2");
        expect(game.BaccaratModel.getInstance().getCardsOrder("/baccarat_micard/B2")).to.have.deep.property('[3]', "banker_2");
        expect(game.BaccaratModel.getInstance().getCardsOrder("")).to.be.empty;
    });
    it('getCards', function() {
        expect(game.BaccaratModel.getInstance().getCards("/baccarat/B1")).to.have.deep.property("player_1",1);
        expect(game.BaccaratModel.getInstance().getCards("/baccarat/B1")).to.have.deep.property("banker_1",1);
        expect(game.BaccaratModel.getInstance().getCards("/baccarat/B1")).to.have.deep.property("player_2",1);
        expect(game.BaccaratModel.getInstance().getCards("/baccarat/B1")).to.have.deep.property("banker_2",1);
        expect(game.BaccaratModel.getInstance().getCards("/baccarat_micard/B2")).to.have.deep.property("player_1",1);
        expect(game.BaccaratModel.getInstance().getCards("/baccarat_micard/B2")).to.have.deep.property("banker_1",1);
        expect(game.BaccaratModel.getInstance().getCards("/baccarat_micard/B2")).to.have.deep.property("player_2",1);
        expect(game.BaccaratModel.getInstance().getCards("/baccarat_micard/B2")).to.have.deep.property("banker_2",1);
        expect(game.BaccaratModel.getInstance().getCards("")).to.be.empty;
    });
    it('getMaxLimit', function() {
        expect(game.BaccaratModel.getInstance().getMaxLimit("/baccarat/B1","banker")).to.equal(10);
        expect(game.BaccaratModel.getInstance().getMaxLimit("/baccarat/B1","player")).to.equal(20);
        expect(game.BaccaratModel.getInstance().getMaxLimit("/baccarat/B1","tie")).to.equal(30);
        expect(game.BaccaratModel.getInstance().getMaxLimit("/baccarat/B1","banker_pair")).to.equal(40);
        expect(game.BaccaratModel.getInstance().getMaxLimit("/baccarat/B1","player_pair")).to.equal(50);
        expect(game.BaccaratModel.getInstance().getMaxLimit("/baccarat_micard/B2","banker")).to.equal(10);
        expect(game.BaccaratModel.getInstance().getMaxLimit("/baccarat_micard/B2","player")).to.equal(20);
        expect(game.BaccaratModel.getInstance().getMaxLimit("/baccarat_micard/B2","tie")).to.equal(30);
        expect(game.BaccaratModel.getInstance().getMaxLimit("/baccarat_micard/B2","banker_pair")).to.equal(40);
        expect(game.BaccaratModel.getInstance().getMaxLimit("/baccarat_micard/B2","player_pair")).to.equal(50);
        expect(game.BaccaratModel.getInstance().getMaxLimit("abc","player_pair")).to.equal(0);
    });
    it('getPlayerLeft', function() {
        expect(game.BaccaratModel.getInstance().getPlayerLeft("/baccarat/B1")).to.equal(0);
        expect(game.BaccaratModel.getInstance().getPlayerLeft("/baccarat_micard/B2")).to.equal(15);
        expect(game.BaccaratModel.getInstance().getPlayerLeft("abc")).to.equal(0);
    });
    it('getBankerLeft', function() {
        expect(game.BaccaratModel.getInstance().getBankerLeft("/baccarat/B1")).to.equal(0);
        expect(game.BaccaratModel.getInstance().getBankerLeft("/baccarat_micard/B2")).to.equal(5);
        expect(game.BaccaratModel.getInstance().getBankerLeft("abc")).to.equal(0);
    });
    it('getPlayerOwner', function() {
        expect(game.BaccaratModel.getInstance().getPlayerOwner("/baccarat/B1")).to.be.null;
        expect(game.BaccaratModel.getInstance().getPlayerOwner("abc")).to.be.null;
        expect(game.BaccaratModel.getInstance().getPlayerOwner("/baccarat_micard/B2")).to.have.deep.property("bet",5);
        expect(game.BaccaratModel.getInstance().getPlayerOwner("/baccarat_micard/B2")).to.have.deep.property("name","user2");
        expect(game.BaccaratModel.getInstance().getPlayerOwner("/baccarat_micard/B2")).to.have.deep.property("status","online");
        expect(game.BaccaratModel.getInstance().getPlayerOwner("/baccarat_micard/B2")).to.have.deep.property("userId",2);
    });
    it('getBankerOwner', function() {
        expect(game.BaccaratModel.getInstance().getBankerOwner("/baccarat/B1")).to.be.null;
        expect(game.BaccaratModel.getInstance().getBankerOwner("abc")).to.be.null;
        expect(game.BaccaratModel.getInstance().getBankerOwner("/baccarat_micard/B2")).to.have.deep.property("bet",10);
        expect(game.BaccaratModel.getInstance().getBankerOwner("/baccarat_micard/B2")).to.have.deep.property("name","user1");
        expect(game.BaccaratModel.getInstance().getBankerOwner("/baccarat_micard/B2")).to.have.deep.property("status","online");
        expect(game.BaccaratModel.getInstance().getBankerOwner("/baccarat_micard/B2")).to.have.deep.property("userId",1);
    });
});
